<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<div id="itemsForm">
	<h2>
		<c:choose>
			<c:when test="${not empty itemBean.id}"><fmt:message key="header.editItem"/></c:when>
			<c:otherwise><fmt:message key="header.addItem"/></c:otherwise>
		</c:choose>
	</h2>
	
	<form:form modelAttribute="itemBean" enctype="multipart/form-data">
		<div class="form_holder">
			<div class="left_col">
				<div class="row">
					<div class="label_holder">
						<fmt:message key="site.name"/>:
					</div>
					<div class="input_holder">
						<form:input path="name"/>
					</div>
				</div>
				<div class="row">
					<div class="label_holder">
						<fmt:message key="site.category"/>:
					</div>
					<div class="input_holder">
						<form:select path="categoryId" multiple="false">
							<option value="-1">- <fmt:message key="site.notSelected"/> -</option>
							<c:if test="${not empty categories}">
								<c:forEach var="category" items="${categories}">
									<option value="${category.id}" <c:if test="${category.id eq itemBean.categoryId}">selected="selected"</c:if>>${category.name}</option>
								</c:forEach>
							</c:if>
						</form:select>
					</div>
				</div>
				<div class="row">
					<div class="label_holder">
						<fmt:message key="site.price"/>:
					</div>
					<div class="input_holder">
						<form:input path="price"/>
					</div>
				</div>
				<div class="row">
					<div class="label_holder">
						<fmt:message key="site.image"/>:
					</div>
					<div class="upload_input_holder">
						<input type="file" name="image"/>
					</div>
					<div class="btn_holder">
						
					</div>
				</div>
			</div>
			<div class="right_col">
				<div>
					<label class="title"><fmt:message key="site.description"/>:</label>
				</div>
				<form:textarea path="description"></form:textarea>
			</div>
		</div>
		
		<div class="btn_row">
			<input type="image" name="_eventId_save" value="<fmt:message key="button.save"/>" src="<c:url value="/images/buttons/save_btn.PNG"/>"/>
			<input type="image" name="_eventId_cancel" value="<fmt:message key="button.cancel"/>" src="<c:url value="/images/buttons/cancel_btn.PNG"/>" class="margin_left_btn"/>
		</div>
	</form:form>
</div>